package gscrapper.dao;

import gscrapper.entity.NintendoGameInfo;

import java.util.List;

public class NintendoGameInfoFileDAO implements NintendoGameInfoDAO {
	public void save(List<NintendoGameInfo> list) {
		StringBuilder builder = new StringBuilder("Title,Registered\n");

		for (NintendoGameInfo game : list) {
			builder.append(String.format("%s,%s\n", //
					CSVHelper.toCSV(game.getTitle()), //
					CSVHelper.toCSV(game.getRegisteredAsString())));
		}

		CSVHelper.saveToFile("nintendogameinfo", builder.toString());
	}
}
